package xworker.gluon.glisten.control;

import com.gluonhq.charm.glisten.control.CharmListCell;
import org.xmeta.ActionContext;
import org.xmeta.Thing;
import xworker.javafx.control.ListCellActions;

public class CharmListCellActions {
    public static void init(CharmListCell<Object> cell, Thing thing, ActionContext actionContext){
        ListCellActions.init(cell, thing, actionContext);
    }

    public static CharmListCell<Object> create(ActionContext actionContext){
        Thing self = actionContext.getObject("self");
        CharmListCell<Object> cell = new CharmListCell<>();
        init(cell, self, actionContext);

        actionContext.peek().put("parent", cell);
        for(Thing child : self.getChilds()){
            child.doAction("create", actionContext);
        }

        actionContext.g().put(self.getMetadata().getName(), cell);
        return cell;
    }
}
